package com.uinnova.product.eam.web.asset.mvc;

import com.alibaba.fastjson.JSONObject;
import com.binary.framework.util.ControllerUtils;
import com.uinnova.product.eam.base.model.DataPermissionInfo;
import com.uinnova.product.eam.config.Env;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/asset/permission")
public class DataPermissionMVC {

    @PostMapping("/getDataPermission")
    public void getDataPermission(HttpServletRequest request, HttpServletResponse response){
        DataPermissionInfo dataPermissionInfo = JSONObject.parseObject(Env.DATA_PERMISSION.getPageConfig(), DataPermissionInfo.class);
        ControllerUtils.returnJson(request, response, dataPermissionInfo.getDataPermissionConfig());
    }

}
